package com.adxon.data;

import com.adxon.MsgException;

public class Tag extends Kindee{
	public final static String BSK="i9";

	protected String	tx;			// text

	public Tag(){
		bsk=BSK;
	}
	protected void commitExt()throws MsgException{
		super.commitExt();
		commit("tx",tx);
	}
	public String getText(){
		return tx;
	}
	public String getUrl(){
		return "/all/*"+tx;
	}
	public boolean setText(String text){
		String s=tx;
		tx=regulate(text);
		return s==null?tx!=null:!s.equals(tx);
	}
	@Override
	public void setup()throws MsgException{
		stp="id BIGINT NOT NULL COMMENT 'id',"+
			"kn INT NOT NULL COMMENT 'kind',"+
			"ow BIGINT NOT NULL COMMENT 'owner id',"+
			"rt TINYINT NOT NULL COMMENT 'rate',"+
			"tc BIGINT NOT NULL COMMENT 'create time',"+
			"tx VARCHAR(255)NOT NULL COMMENT 'text',"+
			"tm BIGINT NOT NULL COMMENT 'modify time',"+
			"PRIMARY KEY(ow,id,tx)";
		super.setup();
	}
	@Override
	public void updateExt()throws MsgException{
		super.updateExt();
		tx=updateString("tx");
	}
}